#include "SDFDebugDrawer.h"
#include <iostream>
#include <osg/Group>
#include <SDFManager.h>
#include <SDFSprayAlgorithm.h>
SDFDebugDrawer::SDFDebugDrawer() : osgbCollision::GLDebugDrawer()
{
    osg::Node* debugRootNode = getSceneGraph ();
    osg::Group* debugRootGroup = dynamic_cast<osg::Group*>(debugRootNode);
    //std::cout<<"SDFDebugDrawer::SDFDebugDrawer root="<<(int)debugRootGroup<<std::endl;
    if(debugRootGroup != NULL)
    {
        debugRootGroup->addChild(SDFManager::instance()->getContactDebugDrawerNode());
        debugRootGroup->addChild(SDFSprayAlgorithm::instance()->getPointsMT());
    }
}

SDFDebugDrawer::~SDFDebugDrawer()
{

}

void SDFDebugDrawer::drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)
{
    osgbCollision::GLDebugDrawer::drawLine(from, to, color);
}

void SDFDebugDrawer::drawTriangle(const btVector3 &a, const btVector3 &b, const btVector3 &c, const btVector3 &color, btScalar alpha)
{

}

void SDFDebugDrawer::drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &, const btVector3 &, const btVector3 &, const btVector3 &color, btScalar alpha)
{

}

void SDFDebugDrawer::drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)
{
    //std::cout<<"SDFDebugDrawer::drawContactPoint"<<std::endl;
    osgbCollision::GLDebugDrawer::drawContactPoint(PointOnB, normalOnB, distance, lifeTime, color);
}
